package com.part2.business.function.Impl;

import java.util.List;

import com.part2.action.common.validator.Validator;
import com.part2.beans.Products;
import com.part2.beans.Smallclass;
import com.part2.business.function.SmallclassService;
import com.part2.common.query.Page;
import com.part2.dao.common.BaseDao;
import com.part2.dao.function.SmallclassDao;

public class SamllclassServiceImpl implements com.part2.business.function.SmallclassService {

	private BaseDao<Smallclass, String> baseDao;
	private SmallclassDao smallClassDao;

	public void setBaseDao(BaseDao<Smallclass, String> baseDao) {
		this.baseDao = baseDao;
	}

	public void setSmallClassDao(SmallclassDao smallClassDao) {
		this.smallClassDao = smallClassDao;
	}

	public void addSmallclass(Smallclass Smallclass) {
		// TODO Auto-generated method stub
		baseDao.save(Smallclass);
	}

	public void deleteSmallclass(String id) {
		// TODO Auto-generated method stub
		if (Validator.isNotNull(id)) {
			Smallclass sma = this.findSmallclassByPrimeKey(id);
			if (sma != null)
				baseDao.delete(sma);
		}
	}

	public List<Smallclass> findSmallclass() {
		// TODO Auto-generated method stub
		return baseDao.findAll(Smallclass.class);
	}

	public Page<Smallclass> findSmallclass(Page<Smallclass> page) {
		// TODO Auto-generated method stub
		return smallClassDao.findSmallClass(page);
	}

	public Smallclass findSmallclassByPrimeKey(String id) {
		// TODO Auto-generated method stub
		return smallClassDao.findSmallclassByPrimeKey(id);
	}

	public void updateSmallclass(Smallclass Smallclass) {
		// TODO Auto-generated method stub
		baseDao.saveOrUpdate(Smallclass);
	}

	public List<Products> findSmallClassByProductsId(String id) {
		// TODO Auto-generated method stub
		return smallClassDao.findSmallClassByProductsId(id);
	}

}
